import {
  createRouter,
  createWebHistory,
  type RouteRecord,
  type RouteRecordRaw,
} from "vue-router";
import Layout from "@/layout/index.vue";
/* const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/login",
      name: "login",
      component: () => import("@/views/login/index.vue"),
    },
    {
      path: "/",
      component: Layout,
      redirect: "/dashboard",
      children: [
        {
          path: "/dashboard",
          name: "dashboard",
          component: () => import("@/views/dashboard/index.vue"),
          meta: {
            title: "首页",
            icon: "HomeFilled",
          },
        },
      ],
    },
    {
      name: "system",
      path: "/system",
      component: Layout,
      meta: {
        title: "系统管理",
        icon: "Setting",
        roles: ["sys:message"],
      },
      children: [
        {
          name: "userList",
          path: "/userList",
          component: () => import("@/views/system/User/UserList.vue"),
          meta: {
            title: "用户管理",
            icon: "UserFilled",
            roles: ["sys:user"],
          },
        },
        {
          name: "roleList",
          path: "/roleList",
          component: () => import("@/views/system/Role/RoleList.vue"),
          meta: {
            title: "角色管理",
            icon: "wallet",
            roles: ["sys:role"],
          },
        },
        {
          name: "menuList",
          path: "/menuList",
          component: () => import("@/views/system/Menu/MenuList.vue"),
          meta: {
            title: "菜单管理",
            icon: "Menu",
            roles: ["sys:menu"],
          },
        },
      ],
    },
    {
      name: "goodsRoot",
      path: "/goodsRoot",
      component: Layout,
      meta: {
        title: "商品管理",
        icon: "Goods",
        roles: ["goods:goodsRoot"],
      },
      children: [
        {
          name: "category",
          path: "/category",
          component: () => import("@/views/category/CategoryList.vue"),
          meta: {
            title: "物品类型管理",
            icon: "ShoppingCartFull",
            roles: ["goods:category"],
          },
        },
        {
          name: "goodsList",
          path: "/goodsList",
          component: () => import("@/views/goods/GoodsList.vue"),
          meta: {
            title: "商品信息",
            icon: "Goods",
            roles: ["goods:goodsList"],
          },
        },
      ],
    },
  ],
}); */
export const constantRouters: Array<RouteRecordRaw> = [
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login/index.vue"),
  },
  {
    path: "/",
    component: Layout,
    redirect: "/dashboard",
    children: [
      {
        path: "/dashboard",
        name: "dashboard",
        component: () => import("@/views/dashboard/index.vue"),
        meta: {
          title: "首页",
          icon: "HomeFilled",
        },
      },
    ],
  },
];
const router = createRouter({
  history: createWebHistory(),
  routes: constantRouters,
});
export default router;
